package com.ie.controller.admin;


import com.ie.comment.http.ResponseResult;
import com.ie.comment.sercurity.anno.AuthIgrone;
import com.ie.entity.GoodsTypeEntity;
import com.ie.sevice.admin.GoodsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @Author: hp
 * @Description: 商品类型控制器
 */
@RestController
@RequestMapping("api/admin/type")
public class GoodsTypeController {

    @Autowired
    private GoodsTypeService  goodsTypeService;


    @AuthIgrone//忽略权限验证
    @PostMapping("getAllGoodsType")
    public ResponseResult<List<GoodsTypeEntity>> getAllGoodsType(){
        return ResponseResult.getSuccessResult(goodsTypeService.list());
    }

    @AuthIgrone//忽略权限验证
    @PostMapping("getGoodsType")
    public ResponseResult<Map<String, Object>> getGoodsType(@RequestBody GoodsTypeEntity goodsTypeEntity){
        return goodsTypeService.getGoodsType(goodsTypeEntity);
    }

    @AuthIgrone//忽略权限验证
    @PostMapping("add")
    public ResponseResult<Map<String , Object>> addGoodsType(@RequestBody GoodsTypeEntity goodsTypeEntity){
        return goodsTypeService.add(goodsTypeEntity);
    }

    @AuthIgrone//忽略权限验证
    @PostMapping("update")
    public ResponseResult<Map<String , Object>> updateGoodsType(@RequestBody GoodsTypeEntity goodsTypeEntity){
        return goodsTypeService.update(goodsTypeEntity);
    }

    @AuthIgrone//忽略权限验证
    @PostMapping("delete")
    public ResponseResult<Map<String , Object>> deleteGoodsType(@RequestBody GoodsTypeEntity goodsTypeEntity){
        return goodsTypeService.delete(goodsTypeEntity);
    }
}
